<template>
  <div class="className">
    <el-card>
      <div slot="header">
        <span>{{ $t("slider.感谢日记管理") }}</span>
      </div>
      <my-table
        :columns="columns"
        :data="data"
        :pagination="pagination"
        :cellStyle="{ padding: '6px 0' }"
        :headerCellStyle="{ background: '#3a3f51', color: '#fff' }"
        @currentChange="currentChange"
      >
      </my-table>
    </el-card>
  </div>
</template>

<script>
import { getMember } from "@s/api";
import myTable from "@c/common/Table/index";
import { getTableData } from "@/mixins";
export default {
  data() {
    return {
      columns: [
        {
          label: "ID",
          width: 50,
          prop: "id"
        },
        {
          label: "姓名",
          prop: "name"
        },
        {
          label: "电话号码",
          prop: "phone"
        },
        {
          label: "部门",
          prop: "branch"
        },
        {
          label: "生日",
          prop: "birthday"
        },
        {
          label: "注册日",
          prop: "register_date"
        },
        {
          label: "注册许可日",
          prop: "register_agree_date"
        },
        {
          label: "最后登陆日",
          prop: "last_login_date"
        },
        {
          label: "操作",
          prop: "",
          width: 120,
          align: "left",
          slot: "operation"
        }
      ]
    };
  },
  components: {
    myTable
  },
  mixins: [getTableData(getMember)],
  created() {
    this.init();
  },
  filters: {
    statusText(val) {
      if (val === undefined) return;
      if (val === 0) {
        return "已完成";
      } else if (val === 1) {
        return "进行中";
      } else {
        return "已取消";
      }
    },
    tagClass(val) {
      if (val === undefined) return;
      if (val === 0) {
        return "success";
      } else if (val === 1) {
        return "warning";
      } else {
        return "danger";
      }
    }
  },
  methods: {
    // init() {
    //   const params = {
    //     currentPage: this.pagination.currentPage,
    //     pageSize: 20
    //   };
    //   getMember(params).then(res => {
    //     this.data = res.list;
    //     // this.pagination.currentPage = res.currentPage;
    //     // this.pagination.pageSize = res.pageSize;
    //     this.pagination.total = res.total;
    //   });
    // },
    // currentChange(val) {
    //   this.pagination.currentPage = val;
    //   this.init();
    // }
  }
};
</script>
